package org.spring.batch.ch01;

import java.util.Date;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.impl.JobDetailImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Quartz Scheduler 是一个灵活的作业调度工具，它用标准的java组件来创建简单或复杂的调度器来执行系统中大量的任务。
 * 它可以帮助你执行系统中定时需要执行的任务和循环执行的任务。
 * 
 * @author wangjie
 *
 */
public class SimpleJob implements Job {

	private final Logger logger = LoggerFactory.getLogger(getClass());

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		JobDetailImpl jobDetail = (JobDetailImpl) context.getJobDetail();
		String jobName = jobDetail.getName();
		JobDataMap dataMap = jobDetail.getJobDataMap();
		logger.info("JobName:" + jobName + ",dataMap:" + dataMap);
		logger.info("=====>>SimpleJob is running ,createTime:" + dataMap.get("createTime") + ", time:" + new Date());
	}

}
